#ifndef _OCTREE_H_
#define _OCTREE_H_
#include <SEngine/Render/Entity/OctreeNode.h>

namespace SEngine
{
    class Octree
    {
    public:
        OctreeNode & CreateNode(BoundingBox boundingBox);
        void DestroyNode(OctreeNode& node);
        OctreeNode & Root();
        template<typename F>
        void Foreach(F && fn) {
            for (auto node : m_nodes) {
                fn(*node);
            }
        }
        OctreeNode & Sample(glm::vec3 pos);
    private:
        std::vector<std::shared_ptr<OctreeNode>> m_nodes;
    };
} // namespace SEngine



#endif